home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 2,801 to 2,900
/
aol-file-protocol-4400-2801-to-2900.zip
/
AOLDLs
/
C++ Files Library
/
FFT and Complex Numbers Library
/
FFTLibrary.sit
/
FFT library ƒ
/
FourierUtilities.cp
< prev
next >
Wrap
Text File
|
1995-01-15
|
906b
|
53 lines
//
// File: FourierUtilities.cp
// Copyright ⌐1994-1995 James Wilson
// All rights reserved.
//
// This document contains the bit-reversing and power utility functions
// used by the FFT and IFFT functions.
#ifndef __FFT__
#include "FFT.h"
#endif
long BitReverse(const long theNum, const long nu)
{
long index, temp1, temp2, k;
temp1 = theNum;
k = 0L;
for(index = 1L; index <= nu; index++)
{
temp2 = temp1 / 2L;
// Do NOT change to "k *= 2L + (temp1 - 2L * temp2)"! The right
// side of the expression is evaluated first and the result is
// k * (2L + (temp1 - 2L * temp2)), not what you wanted!!
k = k * 2L + (temp1 - 2L * temp2);
temp1 = temp2;
}
return k;
}
long LongPower(const long base, const long exp)
{
long index, k, tempExp;
k = 1L;
if(exp != 0L)
{
k = base;
for(index = 1L; index < exp; index++)
{
k *= base;
}
}
return k;
}